//模拟宏offsetof（作用类似：ftell）,用于计算结构体中的偏移量
#include<stdio.h>
#define OFFSEROF(Type,Target) (size_t)&(((Type*)0)->Target)
struct Stu {
	char name[20];
	char sex[6];
	double mark;
	char address[20];
	int age;
};
int main()
{
	printf("%d\n", OFFSEROF(struct Stu, name));
	printf("%d\n", (size_t)&(((struct Stu*)0)->sex));
	printf("%d\n", OFFSEROF(struct Stu,age));
	printf("%d\n", OFFSEROF(struct Stu,mark));
	printf("%d\n", OFFSEROF(struct Stu,address));

	return 0;
}
